﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MLMBonus.Engine
{
    /// <summary>
    /// IVolume is used as a holder for volume objects for each INode. The Id doesn't need to be unique, though it 
    /// probably should be. Pay is called during the bonus run to tell the volume to pay all relevant commissions
    /// for the given INode.
    /// </summary>
    public interface IVolume
    {
        /// <summary>
        /// An Id value for the IVolume. Does not have to be unique.
        /// </summary>
        string Id { get; set; }
        /// <summary>
        /// This method is called for each IVolume associated with an INode. Note that IVolumes are passed up to 
        /// parent INodes unless Pay returns "True".
        /// </summary>
        /// <param name="BonusRunType">
        /// BonusRunType is used so that multiple run types can be handled by a single bonus module. It is expected that
        /// BonusRunType be used inside the method to determine the correct logic to be run at a given time.
        /// </param>
        /// <param name="Distributor">
        /// The INode to be considered when determining payout.
        /// </param>
        /// <returns>
        /// If true, then do not pass this IVolume object up to the next level. This is useful if all payouts have been
        /// made for this volume and there is no longer need to propagate it up the tree.
        /// </returns>
        bool Pay(string BonusRunType, INode Distributor);
    }
}
